package br.com.dojo.controller;

import java.util.Locale;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import br.com.dojo.bean.Acesso;
import br.com.dojo.bean.Cliente;
import br.com.dojo.bean.Contato;
import br.com.dojo.bean.Endereco;
import br.com.dojo.service.ClienteService;

/**
 * Handles requests for the application home page.
 */
@Controller
@RequestMapping(value = "/cliente/**")
public class ClienteController {

	@Autowired
	ClienteService service;

	/*private static final Logger logger = LoggerFactory
			.getLogger(ClienteController.class);*/

	@RequestMapping(value = "/cliente/cadastrar", method = RequestMethod.GET)
	public String cadastrar(Locale locale, Model model) {
		
		model.addAttribute("cliente", new Cliente());
		model.addAttribute("endereco", new Endereco());
		model.addAttribute("contato", new Contato());
		model.addAttribute("acesso", new Acesso());

		return "cliente/cadastrar";
	}

	@RequestMapping(value = "cliente/salvarCadastro", method = RequestMethod.POST)
	public String salvarCadastro(Locale locale, Model model, Cliente cliente,
			Endereco endereco, Contato contato, Acesso acesso) {

		return "cliente/listar";
	}

	@RequestMapping(value = "/listar", method = RequestMethod.POST)
	public String listar(Locale locale, Model model) {

		return "cliente/listar";
	}

	@RequestMapping(value = "/atualizar", method = RequestMethod.POST)
	public String atualizar(Locale locale, Model model) {

		return "cliente/atualizar";
	}

	@RequestMapping(value = "/remover", method = RequestMethod.POST)
	public String remover(Locale locale, Model model) {

		return "cliente/remover";
	}

}
